# Contributor: rubicon <rubicon@mailo.com>
# Maintainer:
pkgname=ocaml-seq
_pkgname=seq
pkgver=0.3.1
pkgrel=1
pkgdesc="Compatibility package for the standard OCaml iterator type"
url="https://github.com/c-cube/seq"
arch="all !riscv64"  # limited by ocaml aport
license="LGPL-2.1-only"
depends="ocaml-runtime"
depends_dev="$pkgname=$pkgver-r$pkgrel"
makedepends="dune ocaml ocaml-findlib"
subpackages="$pkgname-dev"
source="$pkgname-$pkgver.tar.gz::https://github.com/c-cube/seq/archive/v$pkgver.tar.gz"
builddir="$srcdir/$_pkgname-$pkgver"

# 32-bit archs
case "$CARCH" in
	arm*|x86) options="$options textrels" ;;
esac

build() {
	export OCAMLPATH=/usr/lib/ocaml
	dune build @install
}

check() {
	dune runtest
}

package() {
	dune install \
		--destdir="$pkgdir" \
		--prefix=/usr \
		--libdir=/usr/lib/ocaml

	# There's just a readme and changelog.
	rm -Rf "$pkgdir"/usr/doc
}

dev() {
	default_dev

	cd "$pkgdir"

	local path; for path in $(find usr/lib/ocaml \( \
			-name '*.cmt' -o \
			-name '*.cmti' -o \
			-name '*.cmx' -o \
			-name '*.cmxa' -o \
			-name '*.ml' -o \
			-name '*.mli' \
		\))
	do
		amove "$path"
	done
}

sha512sums="
06ce767d3ec1532f8a2421d033f4d9dc5c08c9a27574754d456c31a71ecb9a3c33857591b7d24f85492dce679cd0da8c8985c9fb1a5b5a7f8588d90056b663b8  ocaml-seq-0.3.1.tar.gz
"
